package decrypt

import (
	"fmt"
	"strings"

	"gitee.com/micro-plat/sas/sas/modules/auth/conf"
)

//DecryptDataMap 解密数据map
func DecryptDataMap(oriData map[string]string, decType, secret, sType string, cfg *conf.AuthConfig) (decryptData map[string]string, err error) {
	lType := strings.ToUpper(decType)

	switch lType {
	case "RSA":
		return rsaDecryptMap(oriData, secret, sType, cfg)
	case "DES":
		return desDecryptMap(oriData, secret, cfg)
	case "AES":
		return aesDecryptMap(oriData, secret, cfg)
	default:
		return nil, fmt.Errorf("未知加密类型: %s", decType)
	}
}
